/**
 * 显示或隐藏其他区域的路线
 */
class showOrHideAreaBg {

    showMarkers(datas, key, routerId) {
        datas = JSON.parse( datas );
        var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        OBJECT.markers[routerId] = datas.map(function (data, i) {
            return new google.maps.Marker({
                position: data,
                label: labels[i % labels.length],
                routerId: routerId,

            });
        });
        // Add a marker clusterer to manage the markers.
        OBJECT.markerCluster[routerId] = new MarkerClusterer(map, OBJECT.markers[routerId],
            {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
    }

    /**
     * 隐藏其他区域对象
     * @returns {boolean}
     */
    hideAreaBg() {
        if( CONFIG.showOrHideSatues!='show' )
        {
            return false;
        }

        if( CONFIG.currentOpearateRouterId == null )
        {
            return false;
        }
        let _this = this;
        //遍历其他区域的线路

         for (let key in OBJECT.directionsDisplay) {
             if (OBJECT.directionsDisplay[key].routerId != CONFIG.currentOpearateRouterId) {
                 OBJECT.directionsDisplay[key].setMap(null);
                 OBJECT.bermudaTriangle[key].setMap(null)
             }else{
                 OBJECT.directionsDisplay[key].setMap(null);
                 OBJECT.bermudaTriangle[key].setMap(null);
                 OBJECT.directionsDisplay[key].setOptions({
                     polylineOptions: {
                         strokeOpacity:0
                     }
                 });
                 OBJECT.directionsDisplay[key].setMap(map);
             }
         }
        CONFIG.showOrHideSatues = 'hide';
    };
    showAreaBg() {
        if( CONFIG.showOrHideSatues!='hide' ) {
            return false;
        }
        for (let key in OBJECT.directionsDisplay) {
            let routerKey = OBJECT.routersBgColorMap[key];
            let routers = Session.getInstance().getRoutePoints(key);

            Polygon.draw(routers,map ,key,routerKey)
            Router.getInstance().calculateAndDisplayRoute(routers,key,routerKey);
            OBJECT.directionsDisplay[key].setOptions({
                polylineOptions: {
                    strokeColor:CONFIG.routerStrokeColor[routerKey],
                    strokeOpacity:1
                }
            });
            OBJECT.directionsDisplay[key].setMap(map);
        }
        CONFIG.showOrHideSatues='show'
    }




}